﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="RssMenuDetail.ascx.cs" Inherits="admin_webparts_Plug_ins_RssNews_RssMenuDetail" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="NTTHAO.CommonWeb" %>
<%@ Import Namespace="NTTHAO.Web.BL.Rss" %>

<%
    string bUrl = "?type=" + Request.QueryString["type"] + "&name=" + Request.QueryString["name"] + "&item=" + Request.QueryString["item"] + "&g=" + Request.QueryString["g"];
    string cUrl = bUrl + "&m=" + Request.QueryString["m"];
    bool isAdmin = Context.User.Identity.Name.Equals("admin", StringComparison.OrdinalIgnoreCase);
    int langID = LanguageUtility.GetLanguageID();
    int siteID = WebGlobal.GetSite().ID;
%>
<script type="text/javascript">
    function confirmDelete() {
        var msg = '<%=LanguageUtility.GetLanguageText("CONFIRM_DELETE", Session).Replace("<br />", "\\n")%>';
        return confirm(msg);
    }
</script>
<div class="tip" style="position: relative;">
	<h1 style="left: 0px; position: relative;">Chi tiết menu tin tức RSS</h1>
	<div style="display: block; width: 32px; height: 32px; float: right; position: absolute; top: 5px; right: 5px;"><a title="Click vào đây để quay lại." href="<%=bUrl %>"><img alt="Back" src="resources/images/Back.png" /></a></div>
</div>
<div class="path border" style="margin-bottom: 10px; overflow: hidden;">
    <span class="name" style="float: left;"><%=_Group.Name %></span><div style="float: left; display: inline;"><%
    RssMenu menu = _Menu;
    while (menu != null)
    {
%><span class="name" style="float: right;"><span class="sepa">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><%=menu.Text%></span><%
        menu = RssMenu.GetRssMenu(menu.ParentID);
    } 
%></div>
</div>
<div class="tip" style="margin-top: 10px; position: relative;">
	<h2 style="padding-top: 2px;">Danh sách liên kết RSS thuộc menu</h2>
	<div style="position: absolute; top: 8px; right: 7px; overflow: hidden; display: inline;">
        <span id="spAdd" class="yui-button yui-link-button yuibtn yuibtn-icon btnaddfeed"><span class="first-child"><a href="<%=cUrl %>&action=addlink">Thêm liên kết RSS</a></span></span>
        <script type="text/javascript">
            YAHOO.util.Event.onContentReady("spAdd", function () {
                var spAdd = new YAHOO.widget.Button("spAdd");
            });
        </script>
	</div>
</div>
<table border="1" cellpadding="0" cellspacing="0" class="grid" id="tbGrid">
    <tr>
        <th width="42px">#</th>
        <th>Website</th>
        <th>Hạng mục RSS</th>
        <th>Thời gian update</th>
        <th>Lần cập nhật cuối</th>
        <th>Kích hoạt</th>
        <th width="30px">&nbsp;</th>
    </tr>
<%
if (_List != null)
{
    for (int i = 0; i < _List.Rows.Count; i++)
    {
        DataRow row = _List.Rows[i];
        string id = row[RssLink.ID__COLUMN_NAME].ToString();
        RssSite site = RssSite.GetSite((int)row[RssLink.RSSSITEID__COLUMN_NAME]);
        string name = row[RssLink.NAME__COLUMN_NAME].ToString();
        string url = row[RssLink.RSSURL__COLUMN_NAME].ToString();
        int frequency = (int)row["DetailFrequency"];
        string lastSync = ((DateTime)row["DetailLastSync"]).ToString("yyyy/MM/dd HH:mm");
        lastSync = (lastSync.Equals(DateTime.MaxValue.ToString("yyyy/MM/dd HH:mm"), StringComparison.OrdinalIgnoreCase) ? "-" : lastSync);
        bool activated = (bool)row["DetailActivated"];
%>
    <tr class="<%=(i%2==0?"even":"odd") %>">
        <td align="center"><%=i+1 %></td>
        <td><a class="icon-back" style="background-image:url(<%=site == null ? "" : site.ShortcutIcon %>)" href="<%=site == null ? "#" : site.SiteDomain %>" target="_blank"><%=site == null ? "" : site.SiteName %></a></td>
        <td><a href="<%=url %>" target="_blank"><%=name %></a></td>
        <td align="center"><%=frequency %></td>
        <td align="center"><%=lastSync %></td>
        <td align="center"><%=(activated ? "<img src=\"resources/images/active_l.png\"" : "<img src=\"resources/images/inactive_l.png\"")%></td>
        <td align="left">
            <ul class="icon" style="width: 28px;">
                <li><a title="<%=LanguageUtility.GetLanguageText("DELETE", Session)%>" href="<%=cUrl %>&action=removelink&link=<%=id %>" class="icon deletebn" onclick="javascript: return confirmDelete();">&nbsp;</a></li>
            </ul>
        </td>
    </tr>
<%
    }
}
%>
</table>
